<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Initialize an incremental inflate context</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.inflate-get-status.html">« inflate_get_status</a></li>
      <li style="float: right;"><a href="function.readgzfile.html">readgzfile »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.zlib.html">Zlib 函数</a></li>
    <li>Initialize an incremental inflate context</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.inflate-init" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">inflate_init</h1>
  <p class="verinfo">(PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">inflate_init</span> &mdash; <span class="dc-title">Initialize an incremental inflate context</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.inflate-init-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>inflate_init</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$encoding</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code><span class="initializer"> = []</span></span>): <span class="type"><span class="type"><a href="class.inflatecontext.html" class="type InflateContext">InflateContext</a></span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
    Initialize an incremental inflate context with the specified
    <code class="parameter">encoding</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.inflate-init-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">encoding</code></dt>

    <dd>

     <p class="para">
      One of the <strong><code>ZLIB_ENCODING_*</code></strong> constants.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">options</code></dt>

    <dd>

     <p class="para">
      An associative array which may contain the following elements:
      <dl>
       
        <dt>
<var class="varname">level</var></dt>

        <dd>

         <p class="para">
          The compression level in range -1..9; defaults to -1.
         </p>
        </dd>

       
       
        <dt>
<var class="varname">memory</var></dt>

        <dd>

         <p class="para">
          The compression memory level in range 1..9; defaults to 8.
         </p>
        </dd>

       
       
        <dt>
<var class="varname">window</var></dt>

        <dd>

         <p class="para">
          The zlib window size (logarithmic) in range 8..15; defaults to 15.
         </p>
        </dd>

       
       
        <dt>
<var class="varname">strategy</var></dt>

        <dd>

         <p class="para">
          One of <strong><code>ZLIB_FILTERED</code></strong>,
          <strong><code>ZLIB_HUFFMAN_ONLY</code></strong>, <strong><code>ZLIB_RLE</code></strong>,
          <strong><code>ZLIB_FIXED</code></strong> or
          <strong><code>ZLIB_DEFAULT_STRATEGY</code></strong> (the default).
         </p>
        </dd>

       
       
        <dt>
<var class="varname">dictionary</var></dt>

        <dd>

         <p class="para">
          A <span class="type">string</span> or an <span class="type">array</span> of <span class="type"><span class="type strings">strings</span></span>
          of the preset dictionary (default: no preset dictionary).
         </p>
        </dd>

       
      </dl>

     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.inflate-init-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an inflate context resource (<code class="literal">zlib.inflate</code>) on
   success,  或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.inflate-init-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   If an invalid encoding or option is passed to <code class="parameter">options</code>,
   or the context couldn&#039;t be created, an error of level
   <strong><code>E_WARNING</code></strong> is generated.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.inflate-init-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       On success, this function returns an <span class="classname"><a href="class.inflatecontext.html" class="classname">InflateContext</a></span> instance now;
       previously, a <span class="type">resource</span> was returned.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.inflate-init-notes">
  <h3 class="title">注释</h3>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="simpara">
    Unlike <span class="function"><a href="function.gzinflate.html" class="function">gzinflate()</a></span>, incremental inflate contexts do not
    constrain the length of the decoded data, so provide no automatic protection
    against Zip bombs.
   </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.inflate-init-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.inflate-add.html" class="function" rel="rdfs-seeAlso">inflate_add()</a> - Incrementally inflate encoded data</span></li>
   <li class="member"><span class="function"><a href="function.deflate-init.html" class="function" rel="rdfs-seeAlso">deflate_init()</a> - Initialize an incremental deflate context</span></li>
  </ul>
 </div>


</div></div></div></body></html>